package com.kanshu.client.ui.activity.ipc;

import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;

import com.kanshu.client.R;
import com.kanshu.client.constants.BinderPoolConstants;
import com.kanshu.client.model.menu.MenuItem;
import com.kanshu.client.ui.base.BaseMenuActivity;

import java.util.ArrayList;
import java.util.List;

public class IPCIndexActivity extends BaseMenuActivity {


    @Override
    protected List<? extends MenuItem> provideMenuData() {
        List<MenuItem> menuItems = new ArrayList<>();
        menuItems.add(0, new MenuItem("Messenger测试", R.color.blue_200));
        menuItems.add(1, new MenuItem("AIDL测试", R.color.blue_200));
        menuItems.add(2, new MenuItem("ContentProvider测试", R.color.blue_200));
        menuItems.add(3, new MenuItem("Binder池测试", R.color.blue_200));
        return menuItems;
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        Intent intent = new Intent();
        switch (position) {
            case 0://Messenger测试
                intent.setClass(this, MessengerTestActivity.class);
                break;
            case 1://AIDL测试
                intent.setClass(this, AIDLTestActivity.class);
                break;
            case 2://ContentProvider测试
                intent.setClass(this, ContentProviderTestActivity.class);
                break;
            case 3://Binder池测试
                intent.setClass(this, BinderPoolTestActivity.class);
                break;
            default:
                break;

        }

        startActivity(intent);
    }

    @Override
    protected String provideBarTitle() {
        return "进程间通信（IPC）";
    }
}
